<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="k" uri="/WEB-INF/k.tld"%>
<%
	
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>怀才进销存管理软件 - 销售前台</title>
		<jsp:include page="../inc.jsp"></jsp:include>
		<script type="text/javascript" src="../jslib/date.js"></script>
		<script type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>
		<link href="../web/css/style.css" rel="stylesheet" type="text/css" />
		
		<OBJECT ID="DLPrinter" CLASSID="CLSID:5C230622-45E5-4e3c-893C-3BFDDC4DB5E4"  codebase="<%=basePath %>sale/DLPrinter.CAB" height="0" width="0" ></OBJECT>		
		<script>
		   //打印控件的属性
		   DLPrinter.ContentURL="<%=basePath%>sale/th.jsp";            
           DLPrinter.MarginLeft=4;  //左边距
           DLPrinter.MarginRight=4;  //右边距
           DLPrinter.MarginTop=1;  //上边距
           DLPrinter.MarginBottom=1; //下边距
           //DLPrinter.CopyCount=2;  //打印份数
           DLPrinter.PageHeader="";  //打印页眉
           DLPrinter.PageFooter="";  //打印页脚
           //DLPrinter.IsLandScape=1;  //1横向打印，0纵向打印         
        </script>
        
		<script type="text/javascript">
			
		var calendar,lastIndex;
		var editIndex = undefined;
		var moneyPointProp = 1;
		var pointMoneyProp = 20;
		var pointDeductionBase = 3000;
		$(function(){
		 /* 获取当前积分策略 */
		    $.post("${pageContext.request.contextPath}/xsgl/pointTacticsAction!noAuthDatagridPointTactics.html", function(data) {
			  var jd = JSON.parse(data)[0];
			  if(jd.moneyPointProp!=null&&Number(jd.moneyPointProp)>0){
			  	moneyPointProp = jd.moneyPointProp;
			  }
			  if(jd.pointMoneyProp!=null&&Number(jd.pointMoneyProp)>0){
			  	pointMoneyProp = jd.pointMoneyProp;
			  }
			  if(jd.pointDeductionBase!=null&&Number(jd.pointDeductionBase)>0){
			  	pointDeductionBase = jd.pointDeductionBase;
			  }
			});
		
			calendar = $('#calendar').calendar({
				fit : true,
				current : new Date(),
				border : false,
				onSelect : function(date) {
					$(this).calendar('moveTo', new Date());
				}
			});

			$('#date').val((new Date()).pattern("yyyy-MM-dd"));

			var rid = $('#saleReturnForm').find('input[name=rid]');
			var ridCombobox = rid.combobox({
				url : '${pageContext.request.contextPath}/rkgl/repertoryAction!noAuth_combobox.html',
				valueField : 'id',
				textField : 'name',
				multiple : false,
				editable : false,
				panelHeight : 'auto',
				onLoadSuccess : function() {
					if('${sessionInfo.repertoryIds}'!=null&&'${sessionInfo.repertoryIds}'!='null'){
						rid.combobox('setValue','${sessionInfo.repertoryIds}');
					}
				parent.$.messager.progress('close');
				},
			    onSelect : function(record){
				    if(record.id!=null){
				    	$.ajax({
							url : '${pageContext.request.contextPath}/serial!noAuth_serial.html',
							data : {type : 'XSTH',rid : record.id},
							type : "POST",
							success : function(d){
								$('#serial').val(d);
							}
						});
				    }
				 }
			});

			var uid = $('#saleReturnForm').find('input[name=uid]');
			var uidCombobox = uid.combobox({
				url : '${pageContext.request.contextPath}/qxgl/userAction!noAuth_userInReperCombobox.html',
				valueField : 'id',
				textField : 'username',
				multiple : false,
				editable : false,
				panelHeight : 'auto',
				onLoadSuccess : function() {
					if('${sessionInfo.userId}'!=null&&'${sessionInfo.userId}'!='null'){
						uid.combobox('setValue','${sessionInfo.userId}');
					}
					parent.$.messager.progress('close');
				}
			});
			if('${sessionInfo.repertoryIds}'!=null&&'${sessionInfo.repertoryIds}'!='null'){
				$.ajax({
					url : '${pageContext.request.contextPath}/serial!noAuth_serial.html',
					data : {type : 'XSTH',rid : '${sessionInfo.repertoryIds}'},
					type : "POST",
					success : function(d){
						$('#serial').val(d);
					}
				});
			}

			$("#sserial").live("keypress",function(e) {
				var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
				if (keyCode == 13) {
					var rid = $('#saleReturnForm').find('input[name=rid]').val();
					var sserial = jQuery.trim(jQuery("#sserial").val());
					if(rid==null||rid==""){
						alert("请选择当前仓库！");
						return;
					}else if(sserial==null||sserial==""){
						alert("请输入销售单号！");
						return;
					}else{
						$.ajax({
							url : '${pageContext.request.contextPath}/xsgl/salelistAction!noAuth_checkSalelist.html?model.serial='+sserial+"&model.rid="+rid,
							type : "POST",
							success : function(d){
								var json = $.parseJSON(d);
								if (json.success==null) {
									var f = $('#saleReturnForm');
									f.form("load",{
										slid : json[0].id,
										mname : json[0].mname,
										sdate : json[0].date,
										sserial : json[0].serial,
										uusername : json[0].uusername,
										pointNum : json[0].pointNum,
										discountNum : json[0].discountNum
									});
									getSalelistItems(json[0].id);
								}else{
									parent.sy.messagerShow({
										msg : json.msg,
										title : '提示'
									});
								}
							}
						});
					}
				}
			});
		});

		var datagrid;
		function getSalelistItems(id){
			$(function() {
				datagrid = $('#datagrid').datagrid({
					url : 'salelistAction!noAuth_checkItems.html?model.id='+id,
					title : '销售商品列表',
					fit : true,
					fitColumns : false,
					nowrap : false,
					border : false,
					idField : 'id',
					sortName : 'id',
					sortOrder : 'desc',
					checkOnSelect : false,
					selectOnCheck : true,
				
					columns : [ [ {
						title : '编号',
						field : 'id',
						width : 80,
						sortable : true
					}, {
						title : '商品条码',
						field : 'gbarcode',
						width : 120,
					}, {
						title : '款号',
						field : 'gtype',
						width : 100,
					}, {
						title : '商品名称',
						field : 'gname',
						width : 120,
					}  , {
						title : '颜色',
						field : 'gcolor',
						width : 60
					} , {
						title : '尺码',
						field : 'gsize',
						width : 70
					} , {
						title : '售价',
						field : 'salePrice',
						width : 100
					}, {
						title : '销售数',
						field : 'number',
						width : 80
					},
					 {
						title : '销售金额',
						field : 'total',
						width : 100
					}, {
						title : '退货数 ',
						field : 'returnnum',
						width : 90,
						editor : {
	                        type : 'numberbox'
	                       }
					},{
						title : '退货金额 ',
						field : 'returnmoney',
						width : 100
					},{
						title : '退货id ',
						field : 'srid',
						width : 100,
						hidden : true
					},
					 {
						title : '退货明细id ',
						field : 'sritemid',
						width : 100,
						hidden : true
					},
					 {
						title : '抹零',
						field : 'wipeZero',
						width : 100,
						hidden : true
					}] ],
					onClickCell: function (rowIndex, field, value) {
					    beginEditing(rowIndex, field, value);
					}
					});
					var beginEditing = function (rowIndex, field, value) {
				    if (field != "returnnum")
				        return;
// 				    if (rowIndex != editIndex) { 
				          $('#datagrid').datagrid('beginEdit', rowIndex);
				          editIndex = rowIndex;
				          var ed = $('#datagrid').datagrid('getEditor', { index: rowIndex, field: 'returnnum' });
				         // var tmp=$(ed).val();
				          $(ed.target).blur(function(){ 
	 						
                          $('#datagrid').datagrid('acceptChanges');
                          var returnPoint = 0;
                          var pointNum = parseFloat($("#pointNum").val());//积分
                           var b = parseFloat($(".salelistItems table tr:eq("+ (rowIndex+1) +") td:eq(9) div").html());//退货数量
                           var sp = parseFloat($(".salelistItems table tr:eq("+ (rowIndex+1) +") td:eq(7) div").html());//销售数量

                           if(b>sp){

                        	   alert("退货数量不能大于销售的数量");
                        	   $(".salelistItems table tr:eq("+ (rowIndex+1) +") td:eq(9) div").html("1");
                        	   $(".salelistItems table tr:eq("+ (rowIndex+1) +") td:eq(9) div").find(":input").each(function(){
									alert($(this));
                            	});
							
                           }
                           
                           var price = parseFloat($(".salelistItems table tr:eq("+ (rowIndex+1) +") td:eq(6) div").html());//售价
                           var sprivce  = parseFloat($(".salelistItems table tr:eq("+ (rowIndex+1) +") td:eq(8) div").html());//销售价格
                           var ml = parseFloat($(".salelistItems table tr:eq("+ (rowIndex+1) +") td:eq(13) div").html());//抹零
//                            var discount = parseFloat($("#discountNum").val());//折扣
//                            if(b<=sp&&b>0&&b!=null&&b!='undefinded'&&b!='null'){
                            if(b!=null&&b!='undefinded'&&b!='null'){
                            if(b<=sp&&b>=0){
	                            $(".salelistItems table tr:eq("+ (rowIndex+1) +") td:eq(10) div").html(parseFloat(sprivce/sp*b).toFixed(1));
                            }else{
                            	parseFloat($(".salelistItems table tr:eq("+(i+1)+") td:eq(10) div").html(0));
                            }
                             var zyt = 0;
                             var detail = [];
                             var ids = [];
                             var rows = $('#datagrid').datagrid('getRows');//返回当前页的记录。
                             for(var i=0;i<rows.length;i++){
								var ra = parseFloat($(".salelistItems table tr:eq("+(i+1)+") td:eq(10) div").html());//退货金额
								   var b2 = parseFloat($(".salelistItems table tr:eq("+ (i+1) +") td:eq(9) div").html());//退货数量
								   var id = $(".salelistItems table tr:eq("+(i+1)+") td:eq(0) div").html();//销售明细id
								    if(isNaN(ra)){
									}else{
										if(ra!=null&&ra!='null'&&ra!='undefinded'){
											detail.push(b2);//退货明细数量
											detail.push(ra);//退货明细金额
											ids.push(id);//销售明细id
											zyt += ra;
										}
									}
                             }
                             if(!isNaN(ml)&&ml!=null&&ml!='null'&&ml!='undefinded'){
                             	zyt = zyt-ml;
                             	$("#remark").val("抹零"+ml+"元");
                             }
                             
                             if(!isNaN(pointNum)&&pointNum!=null&&pointNum!='null'&&pointNum!='undefinded'){
                             	if((pointNum/pointMoneyProp)>zyt){
                             		returnPoint=zyt*pointMoneyProp;
                             		zyt=0;
                             	}else{
                             	    zyt-=pointNum/pointMoneyProp;
                             		returnPoint=pointNum-zyt/moneyPointProp;
                             	}
                             }
                            // alert(detail);
                             $(".returnItemIds").val(detail);
							 $(".salelistitemsid").val(ids); 
							 $("#returnAmount").val(parseFloat(zyt).toFixed(2));//退货总数
	 						 //$("#returnPoint").val(parseFloat(returnPoint).toFixed(0));//退货积分
	 						 $("#returnPoint").val(parseInt(returnPoint));//退货积分
                           }								
		                }); 
// 				    }
				  }
			});
	    }


		function submitSale(printnum){
			var rows = datagrid.datagrid('getRows');
			if (rows.length <=0) {
				alert("请输入正确的销售单号");
			}else{
// 				rows = datagrid.datagrid('getSelections');
				if (rows.length <=0) {
					alert("请选择退货商品");
				}else{
					sy.messagerConfirm('请确认', '您确定要退货吗？', function(r) {
						if(r){
							if(rows[0].srid!=null){ 
								$("#id").val(rows[0].srid);
								for(var i=0;i<rows.length;i++){
								var aa = rows[i].sritemid;
									if(!isNaN(aa)&&aa!=null&&aa!='null'&&aa!='undefinded'){
							   			var sritemsid = [];
							   			var lal = [];
							   			var salelistitemsid = [];
										var sl = rows[i].returnnum;
										var je = parseFloat($(".salelistItems table tr:eq("+(i+1)+") td:eq(10) div").html());
										
										$(".returnItemIds").val();
										salelistitemsid.push(rows[i].id);
										sritemsid.push(aa);
										if(!isNaN(sl)&&!isNaN(je)&&sl!=null&&sl!='null'&&sl!='undefinded'&&je!=null&&je!='null'&&je!='undefinded'){
											lal.push(sl);
											lal.push(je);
										}
										$(".returnItemIds").val(lal);
										$(".salelistitemsid").val(salelistitemsid);
										$(".sritemsid").val(sritemsid);
										$('#saleReturnForm').form('submit', {
											url : '${pageContext.request.contextPath}/xsgl/saleReturnlistAction!noAuth_edit.html',
											success : function(d) {
												var json = $.parseJSON(d);
												if(json.success){ 
													sy.messagerShow({
														msg : json.msg,
														title : '提示'
												    });
												}else{
													parent.sy.messagerShow({
														title : '提示',
														msg : json.msg
													});
												}
											}
										});
									}else{	
							   			var sritemsid = [];    
							   			var salelistitemsid = [];
							   			var lal = [];
										var sl = rows[i].returnnum;
										var je = parseFloat($(".salelistItems table tr:eq("+(i+1)+") td:eq(10) div").html());
										$(".sritemsid").val("");
										sritemsid.push(aa);	
										
										salelistitemsid.push(rows[i].id);
										$(".returnItemIds").val();
										if(!isNaN(sl)&&!isNaN(je)&&sl!=null&&sl!='null'&&sl!='undefinded'&&je!=null&&je!='null'&&je!='undefinded'){
											lal.push(sl);
											lal.push(je);
										}
// 										if(lal!=null)
										$(".returnItemIds").val(lal);
										$(".salelistitemsid").val(salelistitemsid);
										$(".sritemsid").val(sritemsid);
										$('#saleReturnForm').form('submit', {
											url : '${pageContext.request.contextPath}/xsgl/saleReturnlistAction!noAuth_addBySrid.html',
											success : function(d) {
												var json = $.parseJSON(d);
												if(json.success){ 
													sy.messagerShow({
														msg : json.msg,
														title : '提示'
												    });
												}else{
													parent.sy.messagerShow({
														title : '提示',
														msg : json.msg
													});
												}
										     }
										})
								 	}
								}   
							}else{
								$('#saleReturnForm').form('submit', {
									url : '${pageContext.request.contextPath}/xsgl/saleReturnlistAction!noAuth_add.html',
									success : function(d) {
										var json = $.parseJSON(d);
										if(json.success){ 
											sy.messagerShow({
												msg : json.msg,
												title : '提示'
										    });
										}else{
											parent.sy.messagerShow({
												title : '提示',
												msg : json.msg
											});
										}
									}
								});
							}
							print(printnum);//重复打印
						}
					});
				}
			}
		}

		
		function logout(){
			sy.messagerConfirm('请确认', '您确定要退出前台销售？', function(r) {
				if(r){
					$.ajax({
						url : '${pageContext.request.contextPath}/loginAction!logout.html',
						type : 'get',
						success:function(){
							self.location.reload();
							if(window.opener){
								opener.location = opener.location;
							}
							window.close();
						}
					});
				}
			});
		}
	 function cancelAll(){
	 	 $(".returnItemIds").val("");
		 $(".salelistId").val(""); 
		 $("#returnAmount").val(0.00);//退货总数
		  var rows = $('#datagrid').datagrid('getRows');//返回当前页的记录。
          for(var i=0;i<rows.length;i++){
			$(".salelistItems table tr:eq("+(i+1)+") td:eq(10) div").html("");
			$(".salelistItems table tr:eq("+(i+1)+") td:eq(0) div").html("");
		}
	 }
	 
	 /* 结算打印 */
	 function print(printnum) {
		//var trcount = $("#saleGoods tr").length;                     
		//var goodCount = parseInt(trcount)-1; //购买商品条数           
		//var url = "http://127.0.0.1:8080/jxc/sale/x.jsp?goodCount="+goodCount+"&id="+slid;
		//DLPrinter.ContentURL="http://127.0.0.1/jxc/sale/th.jsp";            
		//DLPrinter.PrintDirect(); //直接打印不出现打印选择对话框
		// DLPrinter.PrintPreview(); //打印预览
        if(printnum==2){
			DLPrinter.PrintDirect();
			window.setTimeout('DLPrinter.PrintDirect()',3000);
			window.setTimeout('self.location.reload()',4000);
		}else if(printnum==1){
			DLPrinter.PrintDirect();
			window.setTimeout('self.location.reload()',1000);
		}else{
			window.setTimeout('self.location.reload()',1000);
		}
      }
        
	 function goSearchReturn(){
	 	var serial = window.showModalDialog('${pageContext.request.contextPath}/xsgl/saleReturnlistAction!datagridSaleReturn.html',window,'dialogWidth=700px;dialogHeight=560px;');
			if(serial[0]!='null'&&serial[0]!='undefined'){
				$("#sserial").val(serial[0]);
				$("#rid").combobox('setValue',serial[1]);
				$("#sserial").focus();
				autoInput();
			}
    	}

	 //限制退货的时候输入的值
	 function regInputEvent(){

		 //获取table对象
		 var table=$(".datagrid-btable");
	
		 
		 
			 
	 }

	 //双击销售订单列表的时候，自动完成输入
	 function autoInput(){
			//alert("ok");
			var rid = $('#saleReturnForm').find('input[name=rid]').val();
			var sserial = jQuery.trim(jQuery("#sserial").val());
			if(rid==null||rid==""){
				alert("请选择当前仓库！");
				return;
			}else if(sserial==null||sserial==""){
				alert("请输入销售单号！");
				return;
			}else{
				$.ajax({
					url : '${pageContext.request.contextPath}/xsgl/salelistAction!noAuth_checkSalelist.html?model.serial='+sserial+"&model.rid="+rid,
					type : "POST",
					success : function(d){
						var json = $.parseJSON(d);
						if (json.success==null) {
							var f = $('#saleReturnForm');
							f.form("load",{
								slid : json[0].id,
								mname : json[0].mname,
								sdate : json[0].date,
								sserial : json[0].serial,
								uusername : json[0].uusername,
								pointNum : json[0].pointNum,
								discountNum : json[0].discountNum
							});
							
							getSalelistItems(json[0].id);

							try{
								var _rid = $("#rid").combobox('getValue');

								$.ajax({
									url : '${pageContext.request.contextPath}/serial!noAuth_serial.html',
									data : {type : 'XSTH',rid : _rid},
									type : "POST",
									success : function(d){
										$('#serial').val(d);
									}
								});

								
							//	alert(rid);
							}catch(e){
								alert(e);		
							}						
							//
							
						}else{
							parent.sy.messagerShow({
								msg : json.msg,
								title : '提示'
							});
						}
					}
				});
			}
		 
	}
	 	
	</script>
	</head>

	<body>
		<div class="top">
			<div class="logo">
				<img src="${pageContext.request.contextPath}/web/imgs/htlogo.jpg" width="480" height="47" />
			</div>
			<div class="right">
				欢迎您！${sessionInfo.loginName} [${sessionInfo.roleNames}]
				<a href="javascript:void(0)" onclick="logout()">退出登录</a>
				<!-- 
					<a href="#">修改密码</a>
				 -->
			</div>
		</div>
		<div class="content">
			<div class="right">
				<!--日历标题-->
				<div class="title">
					<img src="${pageContext.request.contextPath}/web/imgs/pic1.gif" width="6" height="6" />
					日历
				</div>
				<!--/日历标题-->
				<!--日历-->
				<div style="height:180px;">
					<div id="calendar"></div>
				</div>
				<!--/日历-->
				<!--公告+提醒-->
				<div class="title">
					<ul>
						<li id="cp1" class="cpover" onMouseOver="setTab_('cp',1,5,'cpover')">
							公告<span class="tabRefresh"><a href="javascript:void(0);" onclick="javascript:document.frames('announcementIframe').location.reload()" class="icon-mini-refresh"></a></span>
						</li>
						<li id="cp2" onMouseOver="setTab_('cp',2,5,'cpover')">
							系统提醒<span class="tabRefresh"><a href="javascript:void(0);" onclick="javascript:document.frames('warnIframe').location.reload()" class="icon-mini-refresh"></a></span>
						</li>
					</ul>
				</div>
				<div class="conts">
					<div id="cp_con1">
						<iframe width="100%" height="400px;" scrolling="auto" frameborder="0" onload="javascript:void(0);" name="announcementIframe" id="announcementIframe" src="${pageContext.request.contextPath}/qtmk/announcementAction!noAuth_tabAnnounce.html"></iframe>
					</div>
					<div id="cp_con2" style="display: none;">
						<iframe width="100%" height="400px;" scrolling="no"  frameborder="0" onload="javascript:void(0);" name="warnIframe" id="warnIframe" src="${pageContext.request.contextPath}/qtmk/remindWarnAction!noAuth_tabRemindWarn.html"></iframe>
					</div>
				</div>
				<!--/公告+提醒-->
			</div>
			<div class="left">
				<div class="nav">
					<ul>
						<k:security key="XSGL_QTXS">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/sale.html">
								<img src="${pageContext.request.contextPath}/web/imgs/navxsgl.jpg" width="104" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_XSTH">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/saleReturn.html">
								<img src="${pageContext.request.contextPath}/web/imgs/nav-xsth.jpg" width="104" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_KCCX">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/amount.html">
								<img src="${pageContext.request.contextPath}/web/imgs/nav-kcgl.jpg" width="104" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_HYGL">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/member.html">
								<img src="${pageContext.request.contextPath}/web/imgs/nav-hygl.jpg" width="104" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_RJQS">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/settlement.html">
								<img src="${pageContext.request.contextPath}/web/imgs/nav-rjqs.jpg" width="104" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_XSJLCX">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/salelist.html">
								<img src="../web/imgs/navxsglcx.jpg" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_THJLCX">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/saleReturnlist.html">
								<img src="../web/imgs/navthglcx.jpg" height="35" /> 
							</a>
						</li>
						</k:security>
					</ul>
				</div>
				<div class="cont">
				 <div style=" overflow: hidden;height: 650px;">
					<form id="saleReturnForm" method="post">
						<table border="0" cellspacing="4" class="table">
						    <input name="id" type="hidden" id="id">
							<input name="slid" type="hidden" class="salelistId"/>
							<input name="sritemsid" type="hidden" class="sritemsid"/>
							<input name="items" type="hidden" class="returnItemIds"/>
							<input name="ids" type="hidden" class="salelistitemsid"/>
<!--  							 <input name="id" type="text" id="id"> -->
<!-- 							<input name="slid" type="text" class="salelistId"/> -->
<!-- 							<input name="sritemsid" type="text" class="sritemsid"/> -->
<!-- 							<input name="items" type="text" class="returnItemIds"/> -->
<!-- 							<input name="ids" type="text" class="salelistitemsid"/> -->

							<tr>
								<td align="right" valign="top" class="lanse">
									当前仓库：
								</td>
								<td valign="top">
									<input name="rid" id="rid" type="text" class="input1" style="width: 146px" id="rid"  />
								</td>
								<td width="90" align="right" class="lanse">
									销售&nbsp;&nbsp;单号：
								</td>
								<td width="130">
									<input name="sserial" type="text" class="input1" style="width: 146px" id="sserial" value="" />
								</td>
								<td align="right">
									会员名称：
								</td>
								<td>
									<input type="hidden" id="discountNum" name="discountNum">
									<input name="mname" type="text" class="input1" style="width: 146px" readonly="readonly" id="mname"/>
								</td>
							</tr>
							<tr>
								<td align="right">
									销售日期：
								</td>
								<td>
									<input name="sdate" type="text" class="input1" style="width: 146px" readonly="readonly"/>
								</td>
								<td width="90" align="right" class="lanse">
									销售营业员：
								</td>
								<td width="130">
									<input name="uusername" style="width: 146px" type="text" class="input1" readonly="readonly" id="uusername"/>
								</td>
								<td width="72" align="right">
									使用积分：
								</td>
								<td width="130">
									<input name="pointNum" style="width: 146px" type="text" class="input1" readonly="readonly" id="pointNum" value="0"/>
								</td>
							</tr>
							<tr>
								<td width="72" align="right" class="lanse">
									退货日期：
								</td>
								<td width="130">
									<input name="date" id="date" style="width: 146px" type="text" onclick="WdatePicker()">
								</td>
								<td align="right" class="lanse">
									退货营业员：
								</td>
								<td>
									<input name="uid" type="text" style="width: 146px" class="input1" id="uid"  />
								</td>
								<td width="72" align="right" class="lanse">
									退货单号：
								</td>
								<td width="130">
									<input name="serial" style="width: 146px" type="text" class="input1" readonly="readonly" id="serial" value="0"/>
								</td>
							</tr>
							<tr>
								<td align="right" valign="top">
									备&nbsp;&nbsp;&nbsp;&nbsp;注：
								</td>
								<td colspan="5">
									<label for="textarea"></label>
									<textarea name="remark" id="remark" cols="45" rows="2"></textarea>
									<input type="button" value="销售单号查询" onclick="goSearchReturn();">
								</td>
							</tr>
						</table>
				    </form>
						
					<div data-options="region:'center',border:false" style="overflow: hidden;height:310px;" class="salelistItems">
						<table id="datagrid"  ></table>
					</div>

					<div class="jiesuan">
						<div class="centjs">
							<table width="100%" border="0" class="jsxx">
								<tr>
									<td>应退：</td>
									<td>
										<input name="returnAmount" type="text" class="input1" id="returnAmount" value="0.00" readonly="readonly" />元
									</td>
								</tr>
								<tr>
									<td>积分：</td>
									<td>
										<input name="returnPoint" type="text" class="input1" id="returnPoint" value="0" readonly="readonly" />点
									</td>
								</tr>
							</table>
						</div>
						<div class="rightjs">
							<ul>
								<li>
									<a href="javascript:void(0);" onclick="submitSale(0)" class="button2 dis_block">结算</a>
								</li>
								<li>
									<a href="javascript:void(0);" onclick="submitSale(2)" class="button2 dis_block">结算打印</a>
								</li>
								<li>
									<a href="javascript:void(0);" onclick="cancelAll()" class="button3 dis_block">取 消</a>
								</li>
							</ul>
						</div>
					</div>
				 </div>
              </div>
			</div>
		</div>
		<br/><br/><br/>
		<div class="foot">
			Copyright @ 2013
			<a style="color:#FFFFFF; text-decoration:none;" target="_blank" href="http://www.miitbeian.gov.cn">浙ICP备13002014号-1</a>
			<br>
			杭州怀才商贸有限公司 服务电话：0571-28030726
			<!-- version -->
		</div>
		<div id="bg" class="bg" style="display: none;"></div>
		<iframe id='popIframe' class='popIframe' frameborder='0'></iframe>
	</body>
</html>
